<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="com.blog.utils.ConstantUtil"%>
<%@ page import="com.blog.utils.CommonUtil"%>
<%@ page import="com.blog.utils.SessionUtil"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<base href="${basePath }" />
<title>用户注册</title>
<link rel="stylesheet" href="source/css/main.css" type="text/css"></link>
<link rel="stylesheet" href="source/css/main.css" type="text/css"></link>
<link rel="stylesheet" href="source/css/login.css" type="text/css"></link>
<link rel="stylesheet" href="source/css/form_validate.css"
	type="text/css"></link>
<link rel="stylesheet" type="text/css" href="source/css/img_btn.css" />
<script type="text/javascript" src="source/js/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="source/js/main.js"></script>
<script type="text/javascript" src="source/js/validate.js"></script>
<script type="text/javascript" src="source/js/form_validate.js"></script>
<style type="text/css">
th {
	text-align: right;
}
</style>
</head>
<body>
	<div id="divOutBox">
		<div id="divMainBox">
			<div id="divInBox">
				<div id="divLoginBox">
					<form id="myform" action="register" method="post"
						style="algin: center">
						<fieldset class="fieldset_login" style="width: 500px;">
							<legend align="left"> 用户注册 </legend>
							<table style="width: 450px; padding: 0; margin: 0">
								<tr>
									<th><label class="required_lbl"> * </label> 电子邮箱：</th>
									<td colspan="2"><input type="text" id="regEmail"
										class="txt" name="user.regEmail" value="${user.regEmail}"
										title="请填写你要使用的你的电子邮箱" /> <label id="msgRegEmail" class="msg"></label>
									</td>
								</tr>
								<tr>
									<th><label class="required_lbl"> * </label> 登录密码：</th>
									<td colspan="2"><input type="password" id="user_UserPwd"
										class="txt" name="user.userPwd" value="${user.userPwd}"
										title="请填写你要使用的登录密码" /> <label id="msgUser_UserPwd"
										class="msg"></label></td>
								</tr>
								<tr>
									<th><label class="required_lbl"> * </label> 验证密码：</th>
									<td colspan="2"><input type="password" id="userPwd"
										name="userPwd" value="${userPwd}" class="txt"
										title="请填写你要使用的登录密码" /> <label id="msgUserPwd" class="msg"></label>
									</td>
								</tr>
								<tr>
									<th>用户名称：</th>
									<td colspan="2"><input type="text" id="userName"
										name="user.userName" value="${user.userName}" class="txt"
										title="请填写你要使用的用户名称" /> <label id="msgUserName" class="msg"></label>
									</td>
								</tr>
								<tr>
									<th><label class="required_lbl"> * </label> 验 证 码：</th>
									<td><input type="text" id="vCode" name="vCode"
										style="width: 80px;" value="${requestScope.vCode}" class="txt"
										maxlength="4" title="请填写图片中的验证码" /> &nbsp;&nbsp; <img
										alt="点击重新加载" title="点击更换验证码" class="vcode_img" align="middle"
										src="<s:url action="vCode"/>?+Math.random()"
										onclick="this.src='<s:url action="vCode"/>?r='+Math.random()">
											<label id="msgVCode" class="msg"></label>
									</td>
								</tr>
								<tr>
									<th></th>
									<td><s:checkbox id="serviceItemCheck"
											name="serviceItemCheck" cssClass="input_ck_err" value="1"></s:checkbox>
										<label for="serviceItemCheck">
											同意“服务条款”和“隐私权保护和个人信息利用政策” </label> <label id="msgServiceItemCheck"
										class="msg"></label></td>
								</tr>


								<tr>
									<th><input type="hidden" name="doType"
										value="<%=ConstantUtil.DO_TYPE%>">
									</th>
									<td valign="middle">
										<div class="buttons">
											<button type="button" onclick="checkReg()" class="positive"
												name="save">
												<img src="source/images/btn/apply2.png" /> 注&nbsp;&nbsp;册
											</button>
											<button type="button" href="login.jsp" class="regular"
												name="goURI">
												<img src="source/images/btn/go.png" /> 已有账号，去登录
											</button>
										</div></td>
								</tr>
							</table>
						</fieldset>
					</form>
					<script type="text/javascript">
						var formRegExp = [ {
							objId : 'regEmail',
							regExp : regEmail,
							required : true,
							msgObjId : 'msgRegEmail',
							requiredMsg : '请输入电子邮件！',
							msg : '请输入正确的电子邮件！'
						}, {
							objId : 'user_UserPwd',
							regExp : regPwd,
							required : true,
							msgObjId : 'msgUser_UserPwd',
							requiredMsg : '请输入登录密码！',
							msg : '登录密码只是为6位字符！'
						}, {
							objId : 'userPwd',
							regExp : regPwd,
							required : true,
							msgObjId : 'msgUserPwd',
							sameObjId : 'user_UserPwd',
							requiredMsg : '请输入验证密码！',
							msg : '验证密码只是为6位字符！',
							sameMsg : '两次密码输入不相同！'
						}, {
							objId : 'userName',
							regExp : regName,
							required : false,
							msgObjId : 'msgUserName',
							msg : '用户名称只能为5位以上！'
						}, {
							objId : 'vCode',
							regExp : regVCode,
							required : true,
							msgObjId : 'msgVCode',
							requiredMsg : '请输入验证码！',
							msg : '验证码为4位字母或数字！'
						} ]
						var formClass = {
							cls : 'input_txt',
							errCls : 'input_txt_err',
							errLblCls : 'err'
						}

						function checkReg() {
							var validate = false;
							validate = validateForm(formRegExp, formClass);
							var serviceItemCheckValidate = false;
							if ($("#serviceItemCheck").attr("checked") != true) {
								$("#msgServiceItemCheck").html("请接受服务条款！");
								$("#msgServiceItemCheck").removeClass();
								$("#msgServiceItemCheck").addClass("err");
								$("#serviceItemCheck").removeClass();
								$("#serviceItemCheck").addClass("input_ck_err");
								serviceItemCheckValidate = false;
							} else {
								$("#msgServiceItemCheck").html("");
								$("#msgServiceItemCheck").removeClass("err");
								$("#serviceItemCheck").removeClass();
								serviceItemCheckValidate = true;
							}
							if (validate && serviceItemCheckValidate) {
								myform.submit();
							}
						}
					</script>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
